package a_reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package a_reflect
 * @date 2024/4/14 下午4:37
 */
public class Test04 {
    public static void main(String[] args) {
        Person person = new Person();
        Class<Person> personClass = Person.class;
        Constructor<?>[] declaredConstructors = personClass.getDeclaredConstructors();
        for (Constructor<?> declaredConstructor : declaredConstructors) {
            System.out.println(declaredConstructor);

        }
        System.out.println("+++++++++++++");
        try {
            Constructor<Person> declaredConstructor = personClass.getDeclaredConstructor(String.class, int.class);
            System.out.println(declaredConstructor);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
}
